<template>
	<view>
		<van-nav-bar title="我关注的人" left-text="返回" left-arrow @click-left="onClickLeft" />
		<view class="user">
			<view>
				<img class="userPhoto" :src="OthersInfo[0].userPhoto" alt="">
			</view>
		</view>
		<view class="userName">
			{{OthersInfo[0].userName}}
		</view>
		<view style="display:flex;justify-content: center;">
			<view style="">
				关注（{{attentionNumber}}）
			</view>
			<view style="">
				粉丝（{{fansNumber}}）
			</view>
		</view>
		
		<van-tabs active="a">
			<van-tab title="我的商品" name="a" >
				<view class="box">
					<view  class="goods" v-for="(item,index) in MyGoods" :key="index" v-show="item.state!=2">
						<view class="">
							<img @click="jump(item)" style="width: 320rpx;height: 320rpx;border-radius:5%;margin-left: 10rpx;" :src="item.commodityImg" alt="">
						</view>
						<view style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;font-weight: bold;">
							{{item.commodityName}}
						</view>
						<view style="width: 350rpx;">
							<span style="color: red;font-weight: bold;">￥{{item.currentPrice}}</span>
							<span style="text-decoration: line-through;margin-left: 100rpx;color: gray;">￥{{item.originalPrice}}</span>
						</view>
					</view>
				</view>
			</van-tab>
			<van-tab title="我的评价" name="b">
				<view style="margin-left: 20rpx;margin-top: 30rpx;" v-for="(item,index) in Evaluate" :key="index">
					<view style="display: flex;align-items: center;">
						<img style="width: 50rpx;height: 50rpx;border-radius:100%;" :src="item.userPhoto" alt="">
						<span style="width: 280rpx; margin-left:20rpx ;color: gray;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;">{{item.userName}}</span>
					</view>
					<view style="margin-left: 50rpx;">
						<view class="">
							{{item.commentsToSeller}}
						</view>
						<view v-show="item.commentImg.length>0">
							<img style="width: 600rpx;height: 600rpx;" :src="item.commentImg" alt="">
						</view>
						<view style="color: gray;">
							{{item.time}}
						</view>
					</view>
				</view>
			</van-tab>
		</van-tabs>
	</view>
</template>

<script>
	import request from '../../com/request.js'
	export default {
		data() {
			return {
				OthersInfo:[],
				MyGoods:[],
				fansNumber:0,
				attentionNumber:0,
				Evaluate:[]
			}
		},
		methods: {
			onClickLeft(){
				uni.redirectTo({
					url: '/pages/MyInterest/MyInterest'
				});
			},
			selectOthersInfo(){//查看关注人信息
				console.log(uni.getStorageSync("attention"));
				request({
						url:'api/myprofile/get',
						methods:'get',
						data:{
						  acc:uni.getStorageSync("attention")
						},
						success: (resp) => {
							this.OthersInfo=resp.data.data
							console.log(this.OthersInfo,30);
						}
					})
			},
			jump(item){
				uni.setStorageSync('hx220408commodityId',item.commodityId)
				uni.setStorageSync('hx220408userTel',uni.getStorageSync("attention"))
				uni.redirectTo({
					url: '/pages/goods/goods'
				})
			}
			
		},
		onLoad(){
			this.selectOthersInfo()
			request({//查看用户商品
					url:'api/selectMyGoods/get',
					methods:'get',
					data:{
					  acc:uni.getStorageSync("attention")
					},
					success: (resp) => {
						this.MyGoods=resp.data.data
						console.log(this.MyGoods,48);
					}
				})
				
			request({//查看用户粉丝数量
					url:'api/fansAmount/get',
					methods:'get',
					data:{
					  acc:uni.getStorageSync("attention")
					},
					success: (resp) => {
						this.fansNumber=resp.data.data[0].number
						console.log(this.fansNumber,60);
					}
				})
				
			request({//查看用户关注数量
					url:'api/attentionAmount/get',
					methods:'get',
					data:{
					  acc:uni.getStorageSync("attention")
					},
					success: (resp) => {
						this.attentionNumber=resp.data.data[0].number
						console.log(this.attentionNumber,74);
					}
				})
				
			request({//查看用户评价
				url: 'api/selectEvaluate/get',
				data: {
					acc: uni.getStorageSync("attention")
				},
				success: (resp) => {
					this.Evaluate=resp.data.data
					console.log(this.Evaluate,124)
				}
			})
		}
	}
</script>

<style>
.userPhoto{
	width: 150rpx;
	height: 150rpx;
	border-radius:100% ;
	margin: 0 auto;
}
.user{
	display: flex;
	justify-content: center;
}
.userName{
	text-align: center;
}
.goods{
	width: 350rpx;
	margin-left: 22rpx;
	margin-top: 15px;
}
.box{
	display:flex;
	flex-wrap: wrap;
}
</style>
